import axios from '../axios';

/** *********中台配置的数据******** */
// 广告banner
export const getAdvertisement = () => axios.post('dz-mall/r/system/getAdvertisement');

// 产品推荐
export const getRecomendProdList = (pageIndex) => axios.post('dz-mall/r/product/getRecomendProdList', {
  pageIndex
});

// 栏目基金列表
export const getFundColumn = (columnCode) => axios.post('dz-mall/r/product/getFundColumn', {
  columnCode
});

// 首发基金
export const getIPOFunds = () => axios.post('dz-mall/r/product/getIPOFunds');

/** *********其他产品公用的数据接口******** */

/** *********查询持仓记录******** */
export const position = (params = {}) => axios.post('dz-mall/r/order/position', {
  kind: params.kind,
  business: params.business,
  status: params.status,
  date: params.date
}, {
  loading: true
});

/** *********查询单个产品的持仓记录-私募、信托******** */
export const positionByCode = (prodCode) => axios.post('dz-mall/r/order/positionByCode', {
  prodCode
});

/** *********查询单个持仓记录详情******** */
export const positionDetail = (prodCode, allotno) => axios.post('dz-mall/r/order/detail', {
  prodCode,
  allotno // 必填
});

/** *********综合查询委托记录******** */
export const getRecords = (params) => axios.post('dz-mall/r/order/query/byCondition', {
  kind: params.kind,
  business: params.business,
  status: params.status,
  date: params.date,
  prodCode: params.prodCode
}, {
  loading: true
});

/** *********查询单个委托记录详情******** */
export const byAllotNo = (allotNo, orderType) => axios.post('dz-mall/r/order/query/byAllotNo', {
  allotNo,
  orderType,
});

/** *********搜索******** */
export const searchProd = ({ term, pageNum, pageSize }) => axios.post('dz-mall/r/product/searchProd', {
  term,
  pageNum,
  pageSize
});